package cn.edu.scau.dao;

import cn.edu.scau.entity.GoOutRegister;
import org.apache.ibatis.jdbc.SQL;

public class GoOutRegisterSqlProvider {

    public String insertSelective(GoOutRegister record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("gooutregister");
        
        if (record.getGooutdate() != null) {
            sql.VALUES("gooutDate", "#{gooutdate,jdbcType=DATE}");
        }
        
        if (record.getExpectedbackdate() != null) {
            sql.VALUES("expectedBackDate", "#{expectedbackdate,jdbcType=DATE}");
        }
        
        if (record.getCustomerid() != null) {
            sql.VALUES("customerID", "#{customerid,jdbcType=INTEGER}");
        }
        
        if (record.getActuallybackdate() != null) {
            sql.VALUES("actuallyBackDate", "#{actuallybackdate,jdbcType=DATE}");
        }
        
        if (record.getGooutreason() != null) {
            sql.VALUES("gooutReason", "#{gooutreason,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(GoOutRegister record) {
        SQL sql = new SQL();
        sql.UPDATE("gooutregister");
        
        if (record.getCustomerid() != null) {
            sql.SET("customerID = #{customerid,jdbcType=INTEGER}");
        }
        
        if (record.getActuallybackdate() != null) {
            sql.SET("actuallyBackDate = #{actuallybackdate,jdbcType=DATE}");
        }
        
        if (record.getGooutreason() != null) {
            sql.SET("gooutReason = #{gooutreason,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("gooutDate = #{gooutdate,jdbcType=DATE}");
        sql.WHERE("expectedBackDate = #{expectedbackdate,jdbcType=DATE}");
        
        return sql.toString();
    }
}